package test.multi_thread;

import java.lang.management.ManagementFactory;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import log.debug.LogInterface;
import log.debug.LogTool;

public class SleepingTask extends LiftOff{
	protected static final LogInterface mLog = new LogTool().getLogType();
	private static final String TAG = "SleepingTask";
	
	
	public void run() {
		while(countDown-- > 0){
			mLog.i(TAG, status());
			try {
				TimeUnit.MILLISECONDS.sleep(200);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
	ExecutorService exec = Executors.newCachedThreadPool();
		
		String info = "  ";
		info += "pidInfo==";
		info += ManagementFactory.getRuntimeMXBean().getName();
		info += "\t thread==";
		info += Thread.currentThread().getName();
		
		
		mLog.i(TAG, "main start  "  + info);
		for (int i=0; i<3; i++){
			exec.execute(new SleepingTask());
		}
		exec.shutdown();
		mLog.i(TAG, "main end  "  + info);
		
	}

}
